﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
using FileParser;

namespace _2D_GUI
{
    /// <summary>
    /// Represents classes within a project
    /// </summary>
    class C_Box : C_Shape
    {
        /// <summary>
        /// Brief constructor.
        /// Creates a new C_Shape.
        /// </summary>
        /// <param name="orig"></param>
        /// <param name="boxSize"></param>
        /// <param name="boxLocation"></param>
        /// <param name="boxColor"></param>
        /// <param name="shapes"></param>
        public C_Box(C_DataStructure orig, Size boxSize, Point boxLocation, Color boxColor, C_Shape[] shapes)
            : base(orig, boxSize, boxLocation, boxColor, shapes)
        {
        }

        /// <summary>
        /// Draws a filled in rectangle.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public override void Draw(object sender, PaintEventArgs e)
        {
            // Get equipment
            Graphics g = e.Graphics;
            // Set bounds
            Rectangle rect = new Rectangle(shapeLocation, shapeSize);
            // Draw rectangle
            g.FillRectangle(shapeBrush, rect);
            // Changes the color of inherited shapes
            for (int i = 0; i < shapeArray.Length; i++)
            {
                if(shapeColor == Color.Blue)
                    shapeArray[i].SetColor(Color.Red);
                else if(shapeColor == Color.Red)
                    shapeArray[i].SetColor(Color.LawnGreen);
                else if(shapeColor == Color.LawnGreen)
                    shapeArray[i].SetColor(Color.Yellow);
                else
                    shapeArray[i].SetColor(Color.Blue);
            }
            // Create a new frame in which to draw the inherited shapes in
            C_Frame childShapes = new C_Frame(shapeArray, shapeSize.Width, shapeSize.Height, shapeLocation);
            // Draw inherited shapes
            childShapes.Draw(sender, e);
        }

    }
}